package icu.d4peng.basic.message.mail.properties;

import icu.d4peng.basic.core.constant.ProjectConstant;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

/**
 * MailProperties:邮件属性
 *
 * @author d4peng <a href="d4peng@qq.com">d4peng@qq.com</a>
 * @since 2023.12.03
 */
@Data
@ConfigurationProperties(prefix = MailProperties.PREFIX)
public class MailProperties{

    /**
     * 前缀
     */
    public static final String PREFIX = ProjectConstant.PREFIX + ".mail";

    /**
     * 是否开启
     */
    private boolean enabled = true;

    /**
     * SMTP server host. For instance, 'smtp.example.com'.
     */
    private String host;

    /**
     * SMTP server port.
     */
    private Integer port;

    /**
     * Login user of the SMTP server.
     */
    private String username;

    /**
     * Login password of the SMTP server.
     */
    private String password;

    /**
     * Protocol used by the SMTP server.
     */
    private String protocol = "smtp";

    /**
     * Default MimeMessage encoding.
     */
    private Charset defaultEncoding = StandardCharsets.UTF_8;

    /**
     * Additional JavaMail Session properties.
     */
    private Map<String, String> properties = new HashMap<>();

    /**
     * test connection is available.
     */
    private boolean testConnection = true;

    /**
     * 模板前缀
     */
    private String templatePrefix = "";
    /**
     * 模板后缀
     */
    private String templateSuffix = "";

}
